int MonthlyExpenses= 400+75+100;
int MonthlyIncome = 1000;
double InterestRate = .02
// compute the amount Julien will have saved after one year
int Total = 0;
int InterestEarned =0;
for (x = 1; x<12; x++){ InterestEarned = Total * InterestRate; Total = Total + InterestEarned + MonthlyIncome - MonthlyExpenses
}; cout << total;
Problem solving sequence:
1.Algorithm
2.Pseudo-code
3.Block diagram
4.C/C++ code
Loop (for)
Example (Step 4)
How much money has Julien? Julien spends £400 a month on rent, £75 a month on food, and £100 a month on other expenses. He earns 2% per month on any saving money.